package com.bree.erp.jsf;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.EJB;

import com.bree.erp.entity.Project;
import com.bree.erp.entity.PurchaseRequisition;
import com.bree.erp.entity.User;
import com.bree.erp.service.PurchaseRequisitionService;

public class PurchaseRequisitionListBean {

	private AuthUserBean authUserBean;

	
	@EJB
	private PurchaseRequisitionService prService;


	/**
	 * Retrieve all purchase requisitions owned by the current user.
	 * 
	 * @return
	 */
	public List<PurchaseRequisition> getUserRequests() {
		List<PurchaseRequisition> list = new ArrayList<PurchaseRequisition>(
				prService.list(PurchaseRequisition.QUERY_FIND_USER_PURCHASEREQUISTION, authUserBean.getLoggedInUser()));

		return list;
	}

	public List<PurchaseRequisition> getUserApprovals() {
		List<PurchaseRequisition> list = new ArrayList<PurchaseRequisition>(
				prService.list(PurchaseRequisition.QUERY_FIND_USER_PURCHASEREQUISTIONAPPROVER, authUserBean.getLoggedInUser()));

		return list;
	}

	/**
	 * @return the authUserBean
	 */
	public AuthUserBean getAuthUserBean() {
		return authUserBean;
	}

	/**
	 * @param authUserBean the authUserBean to set
	 */
	public void setAuthUserBean(AuthUserBean authUserBean) {
		this.authUserBean = authUserBean;
	}

	
}
